package technion.gc.api.interfaces;

import technion.gc.api.implementation.GraphCrawler;
import technion.gc.api.implementation.interfaces.IGraphCrawler;

/** Inherit this factory to create different Graph Crawlers
*	with different Traversal Strategies and Graph Node Actions
*/
public abstract class AbstractGraphCrawlerFactory {
	
	/** ITraversalStrategy factory method
	 * 
	 * @return	User implemented ITraversalStrategy
	 */
	public abstract ITraversalStrategy createTraversalStrategy();
	
	/** IGraphNodeAction factory method
	 * 
	 * @return	User implemented IGraphNodeAction
	 */
	public abstract IGraphNodeAction createGraphNodeAction();
	
	/** GraphCrawler factory method
	 * 
	 * @return	User configured GraphCrawler
	 */
	final public IGraphCrawler createGraphCrawler() {
		ITraversalStrategy traversalStrategy = createTraversalStrategy();
		IGraphNodeAction graphNodeAction  = createGraphNodeAction();
		return new GraphCrawler(traversalStrategy, graphNodeAction);
	}
}
